package com.itqf.advice;

import org.aspectj.lang.JoinPoint;
import org.springframework.stereotype.Component;

/**
 * projectName: springframeworkgp8
 *
 * @author: 赵伟风
 * time: 2021/8/4 11:34
 * description:
 */
@Component("timeAdvice")
public class TimeAdvice {

    /**
     *
     * @param joinPoint 包含目标方法的信息和目标方法的对象信息
     */
    public void startTime(JoinPoint joinPoint){
        //获取目标方法名
        String name = joinPoint.getSignature().getName();

        //获取目标类名
        String simpleName = joinPoint.getTarget().getClass().getSimpleName();

        System.out.println(("进入的时间:+::-"+System.currentTimeMillis()).replace("+", simpleName).replace("-", name));
    }


    public  void endTime(JoinPoint joinPoint){
        System.out.println("结束时间:"+System.currentTimeMillis());
    }
}
